import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { createPinia } from 'pinia'
import router from './router/index.ts'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import piniaPluginPersist from 'pinia-plugin-persistedstate';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import permissionDirective  from './components/directives/permission.ts'
// 创建应用
const app = createApp(App)
// 创建pinia
const pinia = createPinia()
pinia.use(piniaPluginPersist);
// 安装插件
app.use(pinia)

app.use(router)
app.use(ElementPlus, { locale: zhCn })
app.use(permissionDirective); // 注册自定义指令
// 挂载应用
app.mount('#app')
// 注册element-plus的图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }